<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- <style>
      table {
        border-collapse: collapse;
        border-spacing: 0;
        
      }
      td {
        border: solid 1px #000;
        width: 100px;
      }
    </style> -->
    <!-- <table>
      <tr>
        <td>姓名</td>
        <td>年龄</td>
        <td>身高</td>
        <td>体重</td>
      </tr>
      <tr>
        <td>张三疯</td>
        <td>18</td>
        <td>186</td>
        <td>110kg</td>
      </tr>
    </table> -->
    <script>
      var uname = prompt("请输入姓名：")
      var age = prompt("请输入年龄：")
      var height = prompt("请输入身高：")
      var weight = prompt("请输入体重：")
      var str = "<style>"
      str +=
        "table {border-collapse: collapse;border-spacing: 0;margin:0 auto;}"
      str += " td { border: solid 1px #000;width: 100px;}"
      str += "</style>"
      str += "<table>"
      str += "<tr>"
      str += "<td>姓名</td><td>年龄</td><td>身高</td><td>体重</td>"
      str += "</tr>"
      str += "<tr>"
      str += `<td>${uname}</td>`
      str += `<td>${age}</td>`
      str += `<td>${height}</td>`
      str += `<td>${weight}kg</td>`
      str += "</tr>"
      str += "</table>"
      document.write(str)
    </script>
  </body>
</html>
